<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin" style="padding: 20px 30px 0 0;">
    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
        <div class="layui-form-item">
            <label class="layui-form-label">选择工作流</label>
            <div class="layui-input-block">
                <select name="flow_id" lay-verify="required" lay-search="" disabled>
                    <option value="">直接选择或搜索选择</option>
                    {foreach $flow as $vo}
                    <option value="{$vo.id}" selected>{$vo.flowcode}-{$vo.flowname}</option>
                    {/foreach}
                </select>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">加班人名称</label>
        <div class="layui-input-block">
            <input type="text" name="name" lay-verify="required" value="{$user_name ?? ''}" placeholder="请输入加班人名称"
                   autocomplete="off"
                   class="layui-input" disabled>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">所属部门</label>
        <div class="layui-input-block">
            <input type="text" name="group_name" lay-verify="required" value="{$group_name ?? ''}" placeholder="请输入所属部门"
                   autocomplete="off"
                   class="layui-input" disabled>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">开始时间</label>
        <div class="layui-input-inline">
            <input type="text" name="start_time" id="start_time" lay-verify="required" placeholder="请输入开始日期"
                   autocomplete="off"
                   class="layui-input">
        </div>
        <div class="layui-input-inline">
            <input type="text" name="s_time" id="s_time" lay-verify="required" placeholder="请输入开始时间"
                   autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">结束时间</label>
        <div class="layui-input-inline">
            <input type="text" name="end_time" id="end_time" lay-verify="required" placeholder="请输入结束日期"
                   autocomplete="off"
                   class="layui-input">
        </div>
        <div class="layui-input-inline">
            <input type="text" name="e_time" id="e_time" lay-verify="required" placeholder="请输入结束时间"
                   autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">加班事由</label>
        <div class="layui-input-block">
            <textarea class="layui-textarea" name="content"></textarea>
        </div>
    </div>
    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="LAY-user-back-submit" id="LAY-user-back-submit" value="确认">
    </div>
</div>

<script src="/static/admin/layui/layui.js"></script>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script>
    layui.config({
        base: '/static/admin/' //静态资源所在路径
    }).extend({
        index: 'lib/index', //主入口模块
        treeTable: '../admin/lib/extend/authtree'
    }).use(['index', 'form', 'laydate'], function () {
        var $ = layui.$, form = layui.form, laydate = layui.laydate;

        var date = new Date();
        var year = date.getFullYear();
        var month = date.getMonth() + 1;
        if (month < 10 && month > 0) {
            month = '0' + month;
        }
        var day = date.getDate();
        if (day < 10 && day > 0) {
            day = '0' + day;
        }
        var now = new Date();
        var sjz = new Date(year + '-' + month + '-' + day);
        //日期范围
        laydate.render({
            elem: '#start_time'
            , trigger: 'click'//呼出事件改成click
            , value: now

        });

        //时间
        laydate.render({
            elem: '#s_time'
            ,type: 'time'
            ,format: 'HH:mm',
            value: '18:00'
            , trigger: 'click'//呼出事件改成click
            ,btns: ['clear', 'confirm']
            ,ready: formatminutes

        });
        //日期范围
        laydate.render({
            elem: '#end_time'
            , trigger: 'click',
            value:now
        });
        //时间
        laydate.render({
            elem: '#e_time'
            ,type: 'time'
            ,format: 'HH:mm'
            , trigger: 'click'//呼出事件改成click
            ,btns: ['clear', 'confirm']
            ,ready: formatminutes

        });
    });
    function  formatminutes(date) {
        var aa = $(".laydate-time-list li ol")[1];
        var showtime = $($(".laydate-time-list li ol")[1]).find("li");
        for (var i = 0; i < showtime.length; i++) {
            var t00 = showtime[i].innerText;
            if (t00 !== "00" && t00 !== "30") {
                showtime[i].remove()
            }
        }
        $($(".laydate-time-list li ol")[2]).find("li").remove();  //清空秒
    }

    function getNowFormatDate() {
        var date = new Date();
        var seperator1 = "-";
        var seperator2 = ":";
        var month = date.getMonth() + 1;
        var strDate = date.getDate();
        if (month >= 1 && month <= 9) {
            month = "0" + month;
        }
        if (strDate >= 0 && strDate <= 9) {
            strDate = "0" + strDate;
        }
        var currentdate = date.getFullYear() + seperator1 + month
            + seperator1 + strDate + " " + date.getHours() + seperator2
            + date.getMinutes() + seperator2 + date.getSeconds();
        return currentdate;
    }


</script>
